#pragma once

#include "GeneratedFiles/ui/ui_ProjectWizard.h"

#include "ProjectTemplate.hpp"




namespace Engine
{
	namespace Edit
	{
		class ProjectWizard
			: public QDialog
		{
			Q_OBJECT

		public:

			ProjectWizard(QWidget* parent);
			virtual ~ProjectWizard();



			/**
			 * @returns the project, if the user has selected a project and clicked ok
			 * @returns an empty pointer otherwise
			 */
			Project::ptr project() const;

		protected slots:

			void onTemplateSelected(const QModelIndex& index);
			void onTemplateActivated(const QModelIndex& index);

			void onNameChanged();
			void onLocationChanged();
			void onBrowse();
			void onAccept();

		protected:

			void updateUi();

			/**
			 * @returns the project template for the given index
			 * @returns nullptr when there is no template
			 */
			const ProjectTemplate* templ(const QModelIndex& index) const;

			/**
			 * Tests if the user may accept the current template.
			 *
			 * @returns false when the user has forgot to select / type something
			 */
			bool canAccept() const;

		private:

			typedef QList<ProjectTemplate>   Templates;

			::Ui::ProjectWizard   ui;
			Templates             m_templates;
			Project::ptr          m_project;
		};
		///////////////////////////////////////////////////////////////////////////////////////////
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
